package org.compiere.model;

import java.sql.ResultSet;
import java.util.List;
import java.util.Properties;

import org.compiere.util.Env;

public class MbpmstandartCharge extends X_bpm_standartCharge {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -5538516058097534570L;


	public MbpmstandartCharge(Properties ctx) {
		super(ctx);
	}

	public MbpmstandartCharge(Properties ctx, int bpm_standartCharge_ID,
			String trxName) {
		super(ctx, bpm_standartCharge_ID, trxName);
	}


	public MbpmstandartCharge(Properties ctx, ResultSet rs, String trxName) {
		super(ctx, rs, trxName);
	}

	public static boolean isValues(int BPM_StandartHours_ID, int C_Charge_ID){
		
		List<MbpmstandartCharge> list = new Query(Env.getCtx(), I_bpm_standartCharge.Table_Name, I_bpm_standartCharge.COLUMNNAME_BPM_StandartHours_ID+"=? \n" +
													"AND "+I_bpm_standartCharge.COLUMNNAME_C_Charge_ID+"=?", null)
		.setParameters(BPM_StandartHours_ID, C_Charge_ID)
		.setOnlyActiveRecords(true)
		.list();
		
		return (list.size() != 0) ? true: false;
	}
	
	public static MbpmstandartCharge[] getLines(Properties ctx, int BPM_StandartHours_ID, String trxName){
		
		List<MbpmstandartCharge> list = new Query(ctx, I_bpm_standartCharge.Table_Name, I_bpm_standartCharge.COLUMNNAME_BPM_StandartHours_ID+"=?", trxName)
		.setParameters(BPM_StandartHours_ID)
		.setOnlyActiveRecords(true)
		.list();
		
		MbpmstandartCharge[] retValue = new MbpmstandartCharge[list.size ()];
		
		list.toArray(retValue);
		
		return retValue;
		
	}

}
